#ifndef _STDIO_HEADER_
#define _STDIO_HEADER_
#include <stdio.h>
#endif

#ifndef _TIME_HEADER_
#define _TIME_HEADER_
#include <time.h>
#endif

#ifndef _LINUX_TIME_HEADER_
#define _LINUX_TIME_HEADER_
#include </usr/include/x86_64-linux-gnu/sys/time.h> // 微秒级计时, linux特有time.h， ubuntu系统置于此文件夹下。
#endif

#define MAXNAME 100
//
// 1. 常量
// 1.0 基本常量
const int NO = 0;
const int YES = 1;
// 1.1 控制流输出参数判断
const char dot = '.';
//
const char *Judge_dot_txt = ".txt";
//
const char *Judge_normal = "-normal";
const char *Judge_elimination = "-elim";
const char *Judge_easy = "-easy"; //将大写字母转小写，降低难度。
const char *Judge_goal = "-g";
const char *Judge_help = "-h";
// 以下三个在v4.0版本中弃用
const char *Judge_exercise_num = "-n";
const char *Judge_rand = "-rand";
const char *Judge_ctrl = "-ctrl";
// 1.2 工作模式
const int mode_null = 1000;
const int mode_normal = 1001;
const int mode_elimination = 1002;
// 以下三个在v4.0版本中弃用
const int mode_abc_positive = 100;
const int mode_abc_rand = 101;
const int mode_ctrl = 102;
/* -------------------------------------------------------------------------- */
// 2. 变量
// 2.1 练习设置
// 2.1.1 练习次数相关
int type_ID = 0;
int num_lines = 0; //练习次数
int tright = 0;
int twrong = 0;
// 2.1.2 练习时间相关
float t_goal = 0.0;
// 2.1.3 练习模式相关
int type_mode = 0;
int if_rand = 0;
int if_ctrl = 0;
int if_help = 0;
int if_easy = 0;
// 2.2 练习内容
char *examword;
char *inword;
int num_word = 0;
int num_letter = 0;
int num_letter_wrong = 0;
// 2.3 计时相关
time_t time_0, time_start;
float val;
struct timeval t_start, t_end;
long t_val_long;
float t_val;
/* -------------------------------------------------------------------------- */
// 3. 文件操作相关
// 3.1 文件指针
FILE *fp_log = NULL;
FILE *fp_dat = NULL;
FILE *fp_ctrl = NULL;
// 3.2 ctrl模式下需要用到的文件名字符串
char work_name[MAXNAME];
char txt_name[MAXNAME];
char log_name[MAXNAME];
char dat_name[MAXNAME];
//